package cn.iocoder.yudao.module.dt.dal.mysql.blacklist;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dt.dal.dataobject.blacklist.BlacklistDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dt.controller.admin.blacklist.vo.*;

/**
 * 黑名单表，用作活动权限设置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BlacklistMapper extends BaseMapperX<BlacklistDO> {

    default PageResult<BlacklistDO> selectPage(BlacklistPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlacklistDO>()
                .eqIfPresent(BlacklistDO::getUserId, reqVO.getUserId())
                .likeIfPresent(BlacklistDO::getUserName, reqVO.getUserName())
                .betweenIfPresent(BlacklistDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlacklistDO::getId));
    }

    default List<BlacklistDO> selectList(BlacklistExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BlacklistDO>()
                .eqIfPresent(BlacklistDO::getUserId, reqVO.getUserId())
                .likeIfPresent(BlacklistDO::getUserName, reqVO.getUserName())
                .betweenIfPresent(BlacklistDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlacklistDO::getId));
    }

}
